package com.feifan.monthhelper.wedget;

import android.view.View;

public abstract class DoubleClickListener implements View.OnClickListener {
    private long lastClick = 0;
    private long times = 500;

    public DoubleClickListener() {
    }

    public DoubleClickListener(int times) {
        this();
        this.times = times;
    }

    @Override
    public void onClick(View v) {
        if ((System.currentTimeMillis() - lastClick >= times)) {
            doOnClick(v);
            lastClick = System.currentTimeMillis();
        }
    }

    public abstract void doOnClick(View view);
}
